#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <numeric>
#include <list>
#include <queue>
#include <iostream>
#include <limits>
#include <string>
using namespace std;
#define forr(a, b) for (int a = 0; a < b; ++a)
#define eps 1e-9
#define inf 1e9
#define pb push_back
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vint;
template<class T>  T gcd(T a, T b){return b?gcd(b,a%b):a;} 
string kb[50];
map<char,int> Q;
int main(){
    int n,m,x,q;
    cin>>n>>m>>x;
    forr(i,n)
        cin>>kb[i];
    cin>>q;
    string t;
    cin>>t;
    int cnt=0;
    forr(i, q){
    if (Q.find(t[i])!=Q.end()){
        cnt+=Q[t[i]];
        continue;
        }
        if (t[i]>='a'&&t[i]<='z'){
            bool ss=false;
            forr (ii,n){
            forr(jj,m){
                if(kb[ii][jj]==tolower(t[i]))
                    ss=true;
            }
            }
            if (!ss)
            {cout<<-1;return 0;}
            continue;
        }

        bool can=true;
        int ok=inf;
        forr (ii,n){
            forr(jj,m){
                if(kb[ii][jj]==tolower(t[i])){
                    forr(iii,n)
                        forr(j,m){
                            if(kb[iii][j]=='S')
                                if((ii-iii)*(ii-iii) + (jj-j)*(jj-j)<=x*x)
                                    ok=min(ok,0);
                                else ok=min(ok,1);                              
                    }
                }
            }
        }
        if (ok==inf)
        {cout<<-1;return 0;}
        cnt+=ok;
        Q[t[i]]=ok;
    }
    cout<<cnt;return 0;
    
}